package com.lyf.design.learn.designmodel.visitor;

/**
 * @AUTHOR LYF
 * @DATE 2022/6/11
 * @VERSION 1.0
 * @DESC
 */
public class Main {
    public static void main(String[] args) {
        Element a = new ElementA();
        Element b = new ElementB();

        Visitor visitorA = new VisitorA();
        Visitor visitorB = new VisitorB();

        visitorA.setName("A visitor");
        visitorB.setName("B visitor");

        ElementStructure elementStructure = new ElementStructure();

        elementStructure.add(a);
        elementStructure.add(b);


        elementStructure.visit(visitorA);
        elementStructure.visit(visitorB);

    }
}
